package com.gemme.gemme.wode;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.gemme.gemme.R;
import com.gemme.gemme.bravh.LoadMoreRefreshUseActivity;
import com.gemme.gemme.fragment.BaseLazyFragment;
import com.gemme.gemme.setting.SettingActivity;
import com.gemme.gemme.view.TvTvArrow;
import com.gemme.gemme.test.TestActivity;


/**
 * Created by sp on 2019/7/18.
 * 首页
 */
public class WodeFragment extends BaseLazyFragment  {
    View inflate;
    Context mContext;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        inflate = inflater.inflate(R.layout.fragment_wode, container, false);

        mContext = WodeFragment.this.getContext();


        return inflate;
    }


    private void initView(View inflate) {
        TvTvArrow setting = inflate.findViewById(R.id.setting);
        TvTvArrow address = inflate.findViewById(R.id.address);
        setting.setLeftText("设置").setRightVisble(false);
        address.setLeftText("收货地址").setRightVisble(false);
        setting.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(mContext, SettingActivity.class));
            }
        });

        setting.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {
                startActivity(new Intent(mContext, LoadMoreRefreshUseActivity.class));
                return false;
            }
        });

        address.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(mContext, AddressNewActivity.class));
            }
        });

        address.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {
                startActivity(new Intent(mContext, TestActivity.class));
                return false;
            }
        });
    }

    @Override
    public void onLazyLoad() {

        //yc
        initView(inflate);
//        getData();
    }








}
